What's the deal with reftype { } ?

Posted by friedo on Stack Overflow See other posts from Stack Overflow or by friedo
Published on 2010-05-25T21:37:38Z Indexed on 2010/05/25 21:41 UTC
Read the original article Hit count: 220

Filed under:

I recently saw some code that reminded me to ask this question. Lately, I've been seeing a lot of this:

use Scalar::Util 'reftype';

if ( reftype $some_ref eq reftype { } ) { ... }

What is the purpose of calling reftype on an anonymous hashref? Why not just say eq 'HASH' ?

© Stack Overflow or respective owner

Related posts about perl